{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "done\n"
     ]
    }
   ],
   "source": [
    "ans = []\n",
    "ansList = open(\"../answerList.txt\", encoding='utf-8')\n",
    "for i in ansList:\n",
    "    if '0' <= i <= ':':\n",
    "        i = ''.join([j for j in i if not j.isdigit()])\n",
    "        i = i.replace('\\n', '*' * 2)\n",
    "        i = i.replace('．', '*' * 2)\n",
    "        i = i.replace(' ', '')\n",
    "        ans.append(i)\n",
    "\n",
    "ansList.close()\n",
    "# print(ans)\n",
    "print('done')"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "#以 utf-8 的编码格式打开指定文件\n",
    "\n",
    "f = open(\"../question-utf-8.txt\", encoding=\"utf-8\")\n",
    "index = 0\n",
    "#输出读取到的数据\n",
    "c = []\n",
    "# print(f.read())\n",
    "# qus = []\n",
    "for i in f:\n",
    "    if '0' <= i <= ':':\n",
    "        i = '#### ' + i\n",
    "        i += ans[index]\n",
    "        index = index + 1\n",
    "    i = i.replace('\\n', '\\r\\n')\n",
    "    c.append(i)\n",
    "\n",
    "f.close()\n",
    "print('done')\n",
    "print(c)\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# out = open('../finall.txt', 'w+',encoding='utf-8')\n",
    "# print(c, file=out)\n",
    "# out.close()\n",
    "# print('done')"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# out = open('../finall.md', 'w+')\n",
    "# print(c, file=out)\n",
    "# print('done')\n",
    "# out.close()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [],
   "source": [
    "f = open('../SSM/mdTest/testmd.txt', 'a', encoding='utf-8')\n",
    "f.write(''.join(c))\n",
    "f.close()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}